# Maintainer: Muflone http://www.muflone.com/contacts/english/
# Contributor: Andrea Zucchelli <zukka77@gmail.com>

pkgname=xca
pkgver=2.4.0
pkgrel=3
pkgdesc='Graphical user interface to OpenSSL, RSA/DSA public keys, certificates, signing requests and revokation lists'
arch=('loong64' 'x86_64')
url='https://hohnstaedt.de/xca/'
license=('BSD')
depends=('qt5-tools' 'libltdl' 'desktop-file-utils' 'gtk-update-icon-cache')
source=("https://github.com/chris2511/${pkgname}/releases/download/RELEASE.${pkgver}/${pkgname}-${pkgver}.tar.gz"
         xca-2.4.0-openssl3.patch::https://github.com/chris2511/xca/commit/f5ac099e948ea354deac75ff9fa09d51453476e1.patch)
sha512sums=('e93e2cf9dc48ed43ee9b51e977f825d81ff08835eb4d77fcbe8f9dc8ce31c77c1da879b48c25ab535717542d1fe84faa6e46c410c116edbee02072040c59667c'
            '094d3057701bccf15fa4371847909718d4c9a19a1900ea4ae09658bf423689af60614449bb1bec161c72b6ec77208608c84ffffbec3530e7c5060224a1f03a2b')

prepare() {
  cd "${pkgname}-${pkgver}"
  patch -Np1 -i ../xca-2.4.0-openssl3.patch
}

build () {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr --sysconfdir=/etc --with-openssl
  sed -i  -r 's/(^LDFLAGS.*$)/LDFLAGS='"'"'-lstdc++'"'"'/' Local.mak
}

package() {
  cd "${pkgname}-${pkgver}"
  make install DESTDIR="${pkgdir}"
  install -m 644 -D COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/COPYRIGHT"
}
